🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / docs / src / commonMain / kotlin / org / meshtastic / feature / docs / translation / DocTranslationService.kt
Displaying Raw • Download
feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/translation/DocTranslationService.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 2.40 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.docs.translation
T8b949e/**
* Service interface for translating documentation pages at runtime.
*
* Used as a fallback when Crowdin-translated markdown bundles are not available for the user's locale. Google flavor
* provides ML Kit implementation; fdroid/desktop/iOS provide a no-op that returns [TranslationResult.Unavailable].
*/
Tff7b72interface T56d364DocTranslationService Tb4b4b4{
T8b949e/** Translate a markdown page to the target locale. Returns the fully-translated markdown or a status. */
Tff7b72suspend Tff7b72fun Td2a8fftranslatePageTb4b4b4(Te6edf3pageIdTb4b4b4: Tffa657StringTb4b4b4, Te6edf3markdownTb4b4b4: Tffa657StringTb4b4b4, Te6edf3targetLocaleTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Te6edf3TranslationResult
T8b949e/** Check if translation to the given locale is possible (model downloaded or downloadable). */
Tff7b72suspend Tff7b72fun Td2a8ffisLanguageAvailableTb4b4b4(Te6edf3localeTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Tffa657Boolean
T8b949e/** Download the translation model for a locale. Only meaningful on google flavor. */
Tff7b72suspend Tff7b72fun Td2a8ffdownloadLanguageModelTb4b4b4(Te6edf3localeTb4b4b4: Tffa657StringTb4b4b4)Tb4b4b4: Te6edf3DownloadResult
Tb4b4b4}
T8b949e/** Result of a translation attempt. */
Tff7b72sealed Tff7b72class T56d364TranslationResult Tb4b4b4{
T8b949e/** Translation succeeded. [translatedMarkdown] contains the complete translated markdown source. */
Tff7b72data Tff7b72class T56d364SuccessTb4b4b4(Tff7b72val Te6edf3translatedMarkdownTb4b4b4: Tffa657StringTb4b4b4) Tb4b4b4: Te6edf3TranslationResultTb4b4b4(Tb4b4b4)
T8b949e/** Translation model needs to be downloaded before translating. */
Tff7b72data Tff7b72class T56d364ModelDownloadRequiredTb4b4b4(Tff7b72val Te6edf3localeTb4b4b4: Tffa657StringTb4b4b4, Tff7b72val Te6edf3estimatedSizeMbTb4b4b4: Tffa657IntTb4b4b4) Tb4b4b4: Te6edf3TranslationResultTb4b4b4(Tb4b4b4)
T8b949e/** Translation is not available on this platform/flavor. Caller should fall back to English. */
Tff7b72data Tff7b72object T56d364Unavailable Tb4b4b4: Te6edf3TranslationResultTb4b4b4(Tb4b4b4)
Tb4b4b4}
T8b949e/** Result of a model download attempt. */
Tff7b72sealed Tff7b72class T56d364DownloadResult Tb4b4b4{
Tff7b72data Tff7b72object T56d364Success Tb4b4b4: Te6edf3DownloadResultTb4b4b4(Tb4b4b4)
Tff7b72data Tff7b72class T56d364FailedTb4b4b4(Tff7b72val Te6edf3reasonTb4b4b4: Tffa657StringTb4b4b4) Tb4b4b4: Te6edf3DownloadResultTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s